#include "main.h"
#include "global.h"

/* Transformation perspective camera -> fenetre */
void reshape( GLsizei w, GLsizei h )
{
  /* aspect de la fenetre */
  double ratio = (double)w/h;

  /* place de l'image dans la fenetre */
  glViewport( 0, 0, w, h );

  /* transformation perspective */
  glMatrixMode( GL_PROJECTION );
  glLoadIdentity();
  
  if( ratio>1 ){
	glFrustum( -cF*ratio, cF*ratio,
	           -cF, cF,
			   //-tb_translation[2]-pF, -tb_translation[2]+pF
			   1, -tb_translation[2]+pF
			  );
  }
  else {
	  glFrustum( -cF, cF,
            	 -cF/ratio, cF/ratio,
				 //-tb_translation[2]-pF, -tb_translation[2]+pF
				 1, -tb_translation[2]+pF
				 );
  }
}
